package com.nuoniu.sibanyun.service.erp.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nuoniu.sibanyun.entity.erp.ErpBarcodeAttributeBo;
import com.nuoniu.sibanyun.mapper.erp.ErpBarcodeAttributeBoMapper;
import com.nuoniu.sibanyun.service.erp.IErpBarcodeAttributeBoService;
import com.nuoniu.sibanyun.userThread.UserInfo;
import com.nuoniu.sibanyun.userThread.UserThreadLocal;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 条码管理-条码属性业务对象 服务实现类
 * </p>
 *
 * @author 白强
 * @since 2021-11-03
 */
@Service
public class ErpBarcodeAttributeBoServiceImpl extends ServiceImpl<ErpBarcodeAttributeBoMapper, ErpBarcodeAttributeBo> implements IErpBarcodeAttributeBoService {

    @Override
    public void saveAttribute(ErpBarcodeAttributeBo attributeBo) {
        saveOrUpdate(attributeBo);
    }

    @Override
    public List<ErpBarcodeAttributeBo> getList() {
        return list();
    }

    @Override
    public List<ErpBarcodeAttributeBo> getByIds(Long ...ids) {
        UserInfo userInfo = UserThreadLocal.get();
        QueryWrapper<ErpBarcodeAttributeBo> queryWrapper = new QueryWrapper<>();
        queryWrapper.in("company_id",userInfo.getCompanyId());
        queryWrapper.in("id",ids);
        return list(queryWrapper);
    }
}
